/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.monVehicule.presentation.entretients;

import com.opensymphony.xwork2.ActionSupport;
import fr.monVehicule.coordination.ajouter.entretiens.AjoutEntretienProcessus;
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;

/**
 *
 * @author David
 */
public class AjouterEntretienAction extends ActionSupport implements SessionAware{
    private EntretienForm entretien;
    Map<String, Object> sessionMap;
    
    public EntretienForm getEntretien() {
        return entretien;
    }

    public void setEntretien(EntretienForm entretien) {
        this.entretien = entretien;
    }
    
    @Override
    public String execute() {
        int idVehicule = (Integer) sessionMap.get("vehiculeSelected");
        AjoutEntretienProcessus processus = new AjoutEntretienProcessus(idVehicule, entretien);
        processus.execute();

        return SUCCESS;
    }

    @Override
    public void setSession(Map<String, Object> map) {
        sessionMap = map;
    }
}
